package com.ice.proxy.handler;

import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

/**
 * Created by ice on 7/21/16.
 */
public class ExecutorHandler implements IExecutorHandler {

    private final Logger logger = LoggerFactory.getLogger(getClass());

    @Override
    public Object invoke(Method method, Object obj, Object... objs) {
        Object result = null;
        try {
            result = method.invoke(obj, objs);
        } catch (IllegalAccessException ex) {
            logger.error(method.getName() + "没有相应的访问权限或条件", ex);
        } catch (IllegalArgumentException ex) {
            logger.error(objs.toString() + "非法的参数使用", ex);
        } catch (InvocationTargetException ex) {
            logger.error(method.getName() + "方法调用出现问题", ex);
        }
        return result;
    }
    
}
